package com.yl.auth.service.impl;

import com.yl.auth.entity.Yaopin;
import com.yl.auth.mapper.YaopinMapper;
import com.yl.auth.service.YaopinService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yl
 * @since 2023-06-16
 */
@Service
public class YaopinServiceImpl extends ServiceImpl<YaopinMapper, Yaopin> implements YaopinService {
    @Resource
    private YaopinMapper yaopinMapper;

    @Override
    public Yaopin getzuixin() {
        return yaopinMapper.getzuixin();
    }

    @Override
    public void add(Integer id, List<Long> arrlist) {
        arrlist.forEach(item->{
            //根据id查询整条数据
            Yaopin yaopin = yaopinMapper.selectById(item);
            //赋值
            yaopin.setHlId(id);
            //修改
            yaopinMapper.updateById(yaopin);
        });
    }
}
